<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../css/nav.css">
    <script src="../js/jquery-1.10.1.min.js"></script>
    <!-- <script src="../js/nav.js"></script> -->
</head>

<body>
    <div class="header">

    </div>
</body>
<script>

    // $.ajax({
    //     url:"./header.html",
    //     success(){

    //     }
    // })

    // load(url, [data], [callback])   载入公共的html
    $(".header").load("./header.html", function () {
        console.log("html载入完毕");


        // 问题  load方法的本质就是ajax请求  => 异步问题(生成 比 js载入慢)
        // 1. html载入完毕 在载入js
        // var script = document.createElement("script");
        // script.src = "../js/nav.js";
        // document.head.append(script);

        $.getScript("../js/nav.js", function () {
            console.log("js载入完毕");
        })

    })





</script>

</html>